package com.example.orderservice.dao;

import com.example.orderservice.entity.Order;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OrderMapper {

    @Select("SELECT id,`user`,money,ordertime FROM `order`")
    List<Order> findOrderList();

    @Insert("INSERT INTO `order` (id,user,money,ordertime) VALUES " +
            "(#{order.id},#{order.user},#{order.money},NOW())")
    int createdOrder(@Param("order") Order order);
}
